function [ posteriori1, posteriori2, errors, Knn, bestVnorm ] = ...
    q2c(train_patterns, train_targets, test_patterns, test_targets)
%Q2C

    Knn=[1 10 25];
   
    for i=1:length(Knn)  
        [resultTargets, Vnorm(i,:,:)] = Nearest_Neighbor(train_patterns, train_targets,...
            test_patterns, Knn(i));

        errors(i,:,:,:) = calculateError(resultTargets, test_targets);
        posteriori1(i) = length(find(resultTargets==0))/length(resultTargets);
        posteriori2(i) = length(find(resultTargets==1))/length(resultTargets);
    end

    [v,i] = min(errors(3,:));
    bestVnorm(:,:) = Vnorm(i,:,:);
end

